Skip to main content

AWSS3PutBucket

Type

command

Summary

Create a bucket.

Syntax

AWSS3PutBucket <pBucket>,<pCustomHeaders>,<pCallback>

Description

Not every string is an acceptable bucket name. For information on bucket naming restrictions, see Working with Amazon S3 Buckets.

The caller of this command will be sent the callback message on completion with two parameters:

  • the request ID
  • the response from the server which should be empty.
  • an error message if one occurred
note

The message is sent before the tsNet connection is closed so it is possible to access the recieved headers using the tsNetRetrHeaders function

For futher details about this API including values for custom headers see the AWS S3 REST API Documentation

Parameters

NameTypeDescription

pBucket

The name of a bucket

pCustomHeaders

Use this array to specify additional request headers. For example you may specify a pre-canned ACL by setting the x-amz-acl to one of the following values:

  • "private" : Owner gets FULL_CONTROL. No one else has access rights (default).
  • "public-read" : Owner gets FULL_CONTROL. The AllUsers group ( see Who Is a Grantee?) gets READ access.
  • "public-read-write" : Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access. Granting this on a bucket is generally not recommended.
  • "aws-exec-read" : Owner gets FULL_CONTROL. Amazon EC2 gets READ access to GET an Amazon Machine Image (AMI) bundle from Amazon S3.
  • "authenticated-read" : Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access.
  • "bucket-owner-read" : Object owner gets FULL_CONTROL. Bucket owner gets READ access. If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
  • "bucket-owner-full-control" : Both the object owner and the bucket owner get FULL_CONTROL over the object. If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
  • "log-delivery-write" : The LogDelivery group gets WRITE and READ_ACP permissions on the bucket. For more information on logs, see (Server Access Logging).

pCallback

A command name to be sent on completion with the server reponse.

Examples

local tCustomHeaders
put "public-read" into tCustomHeaders["x-amz-acl"]
put "REDUCED_REDUNDANCY" into tCustomHeaders["x-amz-storage-class"]
AWSS3PutBucket "mybucket", tCustomHeaders, "putBucketCallback"
put it into tRequestID

on putBucketCallback pRequestID, pResult, pError
if pError is empty then
answer "Bucket created"
end if
end putBucketCallback

function: tsNetGetStatus, tsNetRetrHeaders

library: tsNet